<?php
/**
 * Core_Data_Removenamespacedelements
 * Remove namespaced elements (we do not need them)
 *
 * @author Adrian Stolarski
 */
class Core_Data_Removenamespacedelements implements Core_Data_Xssfilterable {
    
    /**
     * xss_filter()
     * remove all namespaced elements
     * @param type $value
     * @return type $value
     */
    public function xss_filter($value) {
        $value = preg_replace('#</*\w+:\w[^>]*+>#i', '', $value);
 
        do {
            // Remove really unwanted tags
            $old_value = $value;
            $value = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $value);
        }while ($old_value !== $value);
 
        // we are done...
        return $value;
    }

}
